<?php
/**
 * <https://y.st./>
 * Copyright © 2019 Alex Yst <mailto:copyright@y.st>
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <https://www.gnu.org./licenses/>.
**/

$xhtml = array(
	'<{title}>' => 'Mould',
	'takedown' => '2017-11-01',
	'<{body}>' => <<<END
<img src="/img/CC_BY-SA_4.0/y.st./weblog/2019/04/19.jpg" alt="Mouldy gourd" class="framed-centred-image" width="800" height="480"/>
<section id="dreams">
	<h2>Dream journal</h2>
	<p>
		I dreamed I was a part of a small group of humans amongst extra terrestrials.
		The extra terrestrials were blue, and for some reason, wanted us dead.
		Somehow, we thought blue raspberry flavour was toxic to them, so we painted ourselves blue and gave them all blue raspberry slushies.
		They enjoyed the slushies, and they weren&apos;t toxic to them.
		Another member of our group just assumed the slushies were about to kill the extra terrestrials, so they revealed themself and the rest of our group thinking it wouldn&apos;t matter.
		It did matter though, as they were back to trying to kill us.
	</p>
</section>
<section id="drudgery">
	<h2>Drudgery</h2>
	<p>
		My discussion post for the day:
	</p>
	<blockquote>
		<p>
			I couldn&apos;t find an article listed on any of the four websites that specifically discussed concurrency.
			However, I did find an article that touched on it a bit.
			That&apos;s the best I could do though.
			That&apos;s what happens when you limit us to finding a resource from only a subset of the Web.
		</p>
		<p>
			These days, most chipsets have multiple cores, with each core basically being its own processor <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">(Mackay, 2004)</a>.
			That means that for each core you have, you basically have a separate processor that&apos;s able to handle a separate task concurrently to and independent of the other processors.
			However, concurrency in applications isn&apos;t automatic.
			Rather, as we&apos;ve seen last week, a process is single-threaded by default.
			You have to deliberately make the process multi-threaded in order to take advantage of multiple processors at once.
			Furthermore, we saw that there are pitfalls when writing threaded applications, so they must be written carefully to make sure their results are correct.
		</p>
		<p>
			The paper I read recommends using libraries for concurrency on processors <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">(Mackay, 2004)</a>.
			The library can be written once, and written carefully, so it handles threading safely and correctly.
			Applications then built on top of that library don&apos;t need to worry about the details themselves.
			As the paper reminds us, threads are all considered a part of the same process, and are thus able to share data.
			Furthermore, it reminds us that the operating system scheduler is responsible for determining which thread is run on which processor at which time <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">(Mackay, 2004)</a>.
		</p>
		<p>
			The paper says threading works well for computationally-expensive tasks.
			It also says though that when threading is used to prevent {$a['I/O']} blocking from dragging down performance, adding more cores to the machine won&apos;t improve performance by much <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">(Mackay, 2004)</a>.
			The issue, of course, is that an {$a['I/O']}-blocked thread isn&apos;t really using a processor, but instead using some other piece of the hardware, so any processor added to the machine isn&apos;t working on the {$a['I/O']}-blocked thread.
		</p>
		<p>
			When developing libraries though, you need to be aware of thread safety.
			Multiple threads may call the library&apos;s functions concurrently.
			If the library includes code that allows for race conditions, it may not behave properly.
			To fix this, access to shared variable can be placed in critical sections.
			However, the paper recommends another option.
			Instead, variables can be kept not in the library, but in the program calling the library <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">(Mackay, 2004)</a>.
			That way, the variables can be passed in with each function call without fear that multiple threads are working with the same copy of the data.
			A well-written library can also decompose tasks given to it into smaller, threaded tasks, though this takes carful consideration to do safely and efficiently <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">(Mackay, 2004)</a>.
		</p>
		<p>
			The paper goes on to list several tips for writing threaded, thread-safe libraries.
			First, before even writing any of the code, begin with threading in mind.
			Don&apos;t make threading an afterthought, tacked on later.
			Think about what tasks can be broken down and run concurrently.
			It&apos;s also helpful to use abstractions that allow programmers to identify individual tasks that can be threaded, then let the system manage the threads itself.
			After pushing one of the authoring company&apos;s proprietary products (as is done multiple times throughout the paper), OpenMP* is listed as an option for doing this.
			Managing threads by hand can be done, but is cumbersome and prone to error <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">(Mackay, 2004)</a>.
			After that, the remaining suggestions are all plugs to proprietary software that is better left avoided.
		</p>
		<div class="APA_references">
			<h3>References:</h3>
			<p>
				Mackay, D. R. (2004, February 18). <a href="https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf">A Library Based Approach to Threading for Performance</a>. Retrieved from <code>https://software.intel.com/sites/default/files/m/d/4/1/d/8/Mackay_Threaded_Libraries-V3.final.pdf</code>
			</p>
		</div>
	</blockquote>
</section>
<section id="mould">
	<h2>Mouldy gourd</h2>
	<p>
		My toxic former shift leader left some food in my freezer a while back due to being practically homeless and needing a place to stash it.
		I felt bad for them, so I let them use my freezer.
		This was months ago though, and they still haven&apos;t come back to claim it or even made any effort to keep in contact.
		In addition to using my freezer, they put one fruit in my pantry.
		It appears to be some sort of gourd or something.
		Anyway, it&apos;s gone completely mouldy now, with how long they&apos;ve left it.
		I emailed them about it, photographed it, then threw it out.
		Are they even coming back for their other food?
		If they don&apos;t respond by the end of the term, which is almost two months away, I&apos;m probably going to give the food to Summer or my father.
		It&apos;s things I can&apos;t eat myself, such as a jug of milk and a chicken.
	</p>
	<p>
		Well, maybe I&apos;ll first find in my journal what date they left the things with me.
		If it&apos;s been under a year, maybe I&apos;ll continue holding onto them.
		It probably has been less time, it just feels like forever ago.
	</p>
</section>
<section id="homepage">
	<h2>Homepage</h2>
	<p>
		I was feeling unproductive today, so I changed my homepage again.
		Now it shows my progress through my degree, formatted to look like output from a shell script.
		This replaces my résumé, which was on the homepage previously.
		My main focuses right now are my transition and my degree, not job-hunting, so it&apos;s more fitting for what&apos;s going on right now.
		I did get a lot done today though, I just could have done more if I wasn&apos;t instead fiddling with my homepage.
	</p>
</section>
<section id="prayer">
	<h2>Prayer impressions log</h2>
	<p>
		I&apos;m getting a bit on track now as to reading the Book of Mormon again, though I&apos;m reading it at a much slower pace.
		I overloaded myself before, and I&apos;m trying not to do that again.
		The chapter I read before work talked about seers, so that&apos;s what I prayed about.
		I then asked again for a sign, and again for the censorship at the school to be ended.
		All I saw in my mind in response was burning paper.
	</p>
	<p>
		I read a couple chapters after work, due to the first chapter I read not being noteworthy enough for me to write a single thing about it in my notes on the book.
		The second chapter involved mild sexism, so that&apos;s what I prayed about: sexism within the church.
		I asked why, if they exist, Jesus and Elohim allow and even seem to actively encourage sexism within the church.
		I said that we shouldn&apos;t be segregated or divided.
		And I said that if we chose different roles, that&apos;d be one thing, but to be pushed toward certain roles based on our bodily configuration just isn&apos;t right.
		I then asked once more for a sign of their existence, and asked once more for the censorship to be lifted.
	</p>
</section>
END
);
